#ifndef PERSON_H
#define PERSON_H
#include <string>
#include <iostream>

class Person {
   public:
    using sex_t = enum { MAN, WOMAN };
    friend std::istream& read_person(std::istream &is, Person &p);
    friend std::ostream& print_person(std::ostream &os, Person &p);

    Person() = default;
    Person(std::string name) : Person(name, "", 0, MAN){};
    Person(std::string name, std::string addr, int age, sex_t sex)
        : name_(name), addr_(addr), age_(age), sex_(sex){};

    std::string name() const { return name_; }
    std::string address() const { return addr_; }
    int age() const { return age_; }
    sex_t sex() const { return sex_; }

    void set_name(std::string name) { name_ = name; }
    void set_address(std::string addr) { addr_ = addr; }
    void set_age(int age) { age_ = age; }
    void set_sex(sex_t sex) { sex_ = sex; }

    virtual ~Person(){};

   private:
    std::string name_ = "";
    std::string addr_ = "";
    std::uint8_t age_ = 0;
    sex_t sex_ = MAN;
};

std::istream& read_person(std::istream &is, Person &p);
std::ostream& print_person(std::ostream &is, Person &p);

#endif
